package com.ruoyi.web.controller.basic;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.BasicEnterpriseWechatConfig;
import com.ruoyi.system.service.IBasicEnterpriseWechatConfigService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 企业微信配置Controller
 * 
 * @author ruoyi
 * @date 2025-03-02
 */
@RestController
@RequestMapping("/system/basicEnterpriseWechatConfig")
public class BasicEnterpriseWechatConfigController extends BaseController
{
    @Autowired
    private IBasicEnterpriseWechatConfigService basicEnterpriseWechatConfigService;

    /**
     * 查询企业微信配置列表
     */
    @PreAuthorize("@ss.hasPermi('system:basicEnterpriseWechatConfig:list')")
    @GetMapping("/list")
    public TableDataInfo list(BasicEnterpriseWechatConfig basicEnterpriseWechatConfig)
    {
        startPage();
        List<BasicEnterpriseWechatConfig> list = basicEnterpriseWechatConfigService.selectBasicEnterpriseWechatConfigList(basicEnterpriseWechatConfig);
        return getDataTable(list);
    }

    /**
     * 导出企业微信配置列表
     */
    @PreAuthorize("@ss.hasPermi('system:basicEnterpriseWechatConfig:export')")
    @Log(title = "企业微信配置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BasicEnterpriseWechatConfig basicEnterpriseWechatConfig)
    {
        List<BasicEnterpriseWechatConfig> list = basicEnterpriseWechatConfigService.selectBasicEnterpriseWechatConfigList(basicEnterpriseWechatConfig);
        ExcelUtil<BasicEnterpriseWechatConfig> util = new ExcelUtil<BasicEnterpriseWechatConfig>(BasicEnterpriseWechatConfig.class);
        util.exportExcel(response, list, "企业微信配置数据");
    }

    /**
     * 获取企业微信配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:basicEnterpriseWechatConfig:query')")
    @GetMapping(value = "/{enterpriseWechatConfigId}")
    public AjaxResult getInfo(@PathVariable("enterpriseWechatConfigId") Long enterpriseWechatConfigId)
    {
        return success(basicEnterpriseWechatConfigService.selectBasicEnterpriseWechatConfigByEnterpriseWechatConfigId(enterpriseWechatConfigId));
    }

    /**
     * 新增企业微信配置
     */
    @PreAuthorize("@ss.hasPermi('system:basicEnterpriseWechatConfig:add')")
    @Log(title = "企业微信配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BasicEnterpriseWechatConfig basicEnterpriseWechatConfig)
    {
        return toAjax(basicEnterpriseWechatConfigService.insertBasicEnterpriseWechatConfig(basicEnterpriseWechatConfig));
    }

    /**
     * 修改企业微信配置
     */
    @PreAuthorize("@ss.hasPermi('system:basicEnterpriseWechatConfig:edit')")
    @Log(title = "企业微信配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BasicEnterpriseWechatConfig basicEnterpriseWechatConfig)
    {
        return toAjax(basicEnterpriseWechatConfigService.updateBasicEnterpriseWechatConfig(basicEnterpriseWechatConfig));
    }

    /**
     * 删除企业微信配置
     */
    @PreAuthorize("@ss.hasPermi('system:basicEnterpriseWechatConfig:remove')")
    @Log(title = "企业微信配置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{enterpriseWechatConfigIds}")
    public AjaxResult remove(@PathVariable Long[] enterpriseWechatConfigIds)
    {
        return toAjax(basicEnterpriseWechatConfigService.deleteBasicEnterpriseWechatConfigByEnterpriseWechatConfigIds(enterpriseWechatConfigIds));
    }
}
